package drpc;

import org.apache.storm.Config;
import org.apache.storm.thrift.TException;
import org.apache.storm.utils.DRPCClient;
import org.apache.storm.utils.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

public class BasicDRPCClient {
    private static final Logger logger = LoggerFactory.getLogger(BasicDRPCClient.class);

    public static void main(String[] args) throws TException {
        Config config = new Config();

        // 需要获取默认的参数，才能实例化对象，似乎老版本没有这一步
        Map<String, Object> defaultConfig = Utils.readDefaultConfig();
        config.putAll(defaultConfig);

        DRPCClient drpcClient = new DRPCClient(config, "liu", 3772);
        String result = drpcClient.execute("exclamation", "哈哈");
        logger.info(result);
    }
}
